//
//  HotMulImgViewModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/7.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "HotMulImgViewModelCell.h"
#import "UIImageView+WebCache.h"
@interface HotMulImgViewModelCell ()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *firstImgView;
@property (weak, nonatomic) IBOutlet UIImageView *secondImgView;
@property (weak, nonatomic) IBOutlet UIImageView *thirdImgView;
@property (weak, nonatomic) IBOutlet UILabel *sourceLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyCountLabel;
@property (nonatomic,strong) NSMutableDictionary *dictionary;
@end
@implementation HotMulImgViewModelCell

-(void)setModel:(HotMulImgViewModel *)model {
    if (_model != model) {
        _model = model;
    }
}
- (void)layoutSubviews {
    self.titleLabel.text = self.model.title;
    [self.firstImgView sd_setImageWithURL:[NSURL URLWithString:self.model.img]];
    [self.secondImgView sd_setImageWithURL:[NSURL URLWithString:self.model.imgnewextra[0][@"imgsrc"]]];
    [self.thirdImgView sd_setImageWithURL:[NSURL URLWithString:self.model.imgnewextra[1][@"imgsrc"]]];
    self.sourceLabel.text = self.model.source;
    self.replyCountLabel.text = [NSString stringWithFormat:@"%@跟帖",self.model.replyCount];

    self.firstImgView.userInteractionEnabled = YES;
    self.secondImgView.userInteractionEnabled = YES;
    self.thirdImgView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewAction:)];
    [self.firstImgView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewSecondAction:)];
    [self.secondImgView addGestureRecognizer:tap1];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewThirdAction:)];
    [self.thirdImgView addGestureRecognizer:tap2];
    
}
- (void)bigImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.firstImgView];
    }
- (void)bigImageViewSecondAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.secondImgView];
}
- (void)bigImageViewThirdAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.thirdImgView];
}
+ (CGFloat)height {
    return 200;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
